package com.xiongtian.springframework.context.support;

/**
 * @Author: xiongtian
 * @CreateTime: 2025-03-31  10:14
 * @Version: 1.0
 * @Description: 类路径下的 XML 应用上下文
 */

public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {

    private String[] configLocations;

    public ClassPathXmlApplicationContext() {
    }


    /**
     * 从 XML 中加载 BeanDefinition，并刷新上下文
     *
     * @param configLocations 配置文件
     */
    public ClassPathXmlApplicationContext(String configLocations) {
        this(new String[]{configLocations});
    }


    /**
     * 从 XML 中加载 BeanDefinition，并刷新上下文
     *
     * @param configLocations 配置文件
     */
    public ClassPathXmlApplicationContext(String[] configLocations) {
        this.configLocations = configLocations;
        refresh();
    }

    /**
     * 获取配置文件
     *
     * @return 配置文件
     */
    @Override
    protected String[] getConfigLocations() {
        return configLocations;
    }

}
